package com.luke.dubbo.user.service.impl;

import com.alibaba.dubbo.rpc.RpcContext;
import com.alibaba.dubbo.rpc.RpcException;
import com.luke.dubbo.api.bean.UserAddress;
import com.luke.dubbo.api.service.UserService;
import java.net.InetAddress;
import java.util.Arrays;
import java.util.List;

public class UserServiceImpl implements UserService {

	@Override
	public List<UserAddress> getUserAddressList(String userId) {
		System.out.println("---------getUserAddressList-----------userId:"+userId);
		UserAddress address1 = new UserAddress(1, "北京天安门广场",userId);
		String index = RpcContext.getContext().getAttachment("index");
		System.out.println("index:"+index);
		try {
			address1.setIp(InetAddress.getLocalHost().getHostAddress());
			Thread.sleep(2000);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Arrays.asList(address1);
	}

}
